<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="middle myclear">
	<div class="pad10">
		<h2 class="marbottom10 martop20">
			Danh sách quảng cáo đã hạ cần kiểm tra
		</h2>
	</div>
<?php if(count($items) > 0){?>
	<div class="text-right" style="padding-bottom:5px">
		Trang <select onchange="trackingBannerView(this.options[this.selectedIndex].value);">
		<?php for ($i = 1; $i <= $pages; $i++){?>
			<option value="<?php echo $i;?>" <?php if($i == $page) echo 'selected="selected"';?>><?php echo $i;?></option>
		<?php }?>
		</select> / <?php echo $pages;?> trang.
	</div>
	<table class="tbl-list tbpadd" width="100%" border="1">
		<tr>
			<td width="5%" class="td-label" style="text-align:center">
				<b>#</b>
			</td>
			<td width="30%" class="td-label">
				<b>Tên Chiến dịch</b>
			</td>
			<td class="td-label">
				<b>Tên Quảng cáo</b>
			</td>
			<td class="td-label">
				<b>Ngày hạ</b>
			</td>
		</tr>
		<?php foreach ($items as $i => $item){?>
		<tr class="row">
			<td style="text-align:center">
				<?php echo ($i + 1) + ($page - 1)*$limit;?>
			</td>
			<td>
				<a href="<?php echo site_url('campaigndetail/?campaignid='.$item->campaignid.'&fromdate='.$fromdate.'&todate='.$todate);?>" target="_blank">
					<?php echo $item->campaignname;?>
				</a>
			</td>
			<td>
				<a href="<?php echo site_url('bannerdetail/?bannerid='.$item->bannerid.'&fromdate='.$fromdate.'&todate='.$todate);?>" target="_blank">
					<?php echo $item->bannername;?>
				</a>
			</td>
			<td>
				<?php $date = new DateTime($item->timedown); echo $date->format('d-m-Y H:i:m');?>
			</td>
		</tr>
		<?php }?>
		<tr>
			<td colspan="4" class="td-label text-right">
				Trang <select onchange="trackingBannerView(this.options[this.selectedIndex].value);">
				<?php for ($i = 1; $i <= $pages; $i++){?>
					<option value="<?php echo $i;?>" <?php if($i == $page) echo 'selected="selected"';?>><?php echo $i;?></option>
				<?php }?>
				</select> / <?php echo $pages;?> trang.
			</td>
		</tr>
	</table>
<script type="text/javascript">
$(function(){
	$('.tbl-list .row').mouseover(function(){
		$(this).css('background','#ffc');
	});
	$('.tbl-list .row').mouseout(function(){
		$(this).css('background','none');
	});
});
function trackingBannerView()
{
	$strPage = (arguments[0] ? '/?page=' + arguments[0] : '');
	window.location.href = '<?php echo site_url('tracking/trackingBannerDown');?>' + $strPage;
}
</script>
<?php } else echo '<br />Không có dữ liệu.';?>
</div>
<br />